package cn.iocoder.yudao.module.member.dal.mysql.shunfengcheorder;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.shunfengcheorder.vo.ShunfengcheOrderExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.shunfengcheorder.vo.ShunfengcheOrderPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.shunfengcheorder.ShunfengcheOrderDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 公众号顺风车订单 Mapper
 *
 * @author 路小强
 */
@Mapper
public interface ShunfengcheOrderMapper extends BaseMapperX<ShunfengcheOrderDO> {

    default PageResult<ShunfengcheOrderDO> selectPage(ShunfengcheOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShunfengcheOrderDO>()
                .eqIfPresent(ShunfengcheOrderDO::getAppId, reqVO.getAppId())
                .likeIfPresent(ShunfengcheOrderDO::getStartAddress, reqVO.getStartAddress())
                .eqIfPresent(ShunfengcheOrderDO::getEndAddress, reqVO.getEndAddress())
                .eqIfPresent(ShunfengcheOrderDO::getCreator, reqVO.getEndAddress())
                .eqIfPresent(ShunfengcheOrderDO::getAppendices, reqVO.getAppendices())
                .betweenIfPresent(ShunfengcheOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShunfengcheOrderDO::getId));
    }

    default List<ShunfengcheOrderDO> selectList(ShunfengcheOrderExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShunfengcheOrderDO>()
                .eqIfPresent(ShunfengcheOrderDO::getAppId, reqVO.getAppId())
                .likeIfPresent(ShunfengcheOrderDO::getStartAddress, reqVO.getStartAddress())
                .eqIfPresent(ShunfengcheOrderDO::getEndAddress, reqVO.getEndAddress())
                .eqIfPresent(ShunfengcheOrderDO::getAppendices, reqVO.getAppendices())
                .betweenIfPresent(ShunfengcheOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShunfengcheOrderDO::getId));
    }

}
